package gat.api.rest.background.tg;

import com.bitsun.core.common.persistence.Pager;
import com.bitsun.core.common.web.ResultDTO;
import gat.api.config.annotation.CheckPermissions;
import gat.application.tg.UserBotService;
import gat.dto.req.tg.UserBotReqDto;
import gat.dto.req.tg.UserRelationBotReqDto;
import gat.dto.res.tg.UserBotResDto;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.Valid;
import java.util.Map;

/**
 * 用户-机器人
 * @Author: yanshukeji-java
 * @Email: yanshukeji-java
 */
@Slf4j
@SuppressWarnings("unchecked")
@RestController
@RequestMapping("/userBot")
public class UserBotApiController {


    @Autowired
    private UserBotService userBotService;

    /**
     * 新增用户和机器人的关联关系
     * @param reqDto
     * @return
     */
    @CheckPermissions(value = "userBot:save")
    @PostMapping(consumes = {"application/json"}, produces = {"application/json"})
    public ResultDTO<UserBotResDto> addUserBot(@RequestBody UserRelationBotReqDto reqDto) {
        userBotService.saveRelationBot(reqDto);
        return ResultDTO.ok();
    }
}
